<template>
  <!-- 更新红黄牌公示 -->
  <base-breadcrumb :title="$route.meta.title">
    <div class="page-body">
      <a-form-model
        ref="form"
        :model="formInfo"
        :rules="rules"
        :label-col="{ span: 6 }"
        :wrapper-col="{ span: 18 }"
        :hide-required-mark="true"
      >
        <a-spin :spinning="loadingDetail">
          <a-card :bordered="false">
            <title-name title="基本信息" />
            <a-row :gutter="24">
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="发牌对象"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="dealObjId"
                >
                  <a-select
                    v-model="formInfo.dealObjId"
                    :disabled="isDisabled || isDisabledQuestion"
                    placeholder="请选择发牌对象"
                  >
                    <a-select-option
                      v-for="item in dealObjList"
                      :key="item.id"
                      :value="item.id"
                    >
                      {{
                      item.name
                    }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
                            <a-col
                              :md="16"
                              :sm="16"
                            >
                              <a-form-model-item
                                label="所属单位"
                                :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                                prop="projectId"
                              >
                                <org-tree-select
                                  v-model="formInfo.projectId"
                                  :disabled="(isDisabled || isDisabledQuestion)"
                                  check-strictly
                                  is-auto-select-first
                                  is-need-auth
                                  :is-query-projec-detail="false"
                                  @select="selectOrg"
                                />
                              </a-form-model-item>
                            </a-col>
<!--              <a-col-->
<!--                :md="8"-->
<!--                :sm="8"-->
<!--              >-->
<!--                <a-form-model-item-->
<!--                  label="分公司"-->
<!--                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"-->
<!--                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
<!--                  prop="branchComId"-->
<!--                >-->
<!--                  <SelectSubCompany-->
<!--                    v-model="formInfo.branchComId"-->
<!--                    :disabled="isDisabled || isDisabledQuestion"-->
<!--                  />-->
<!--                </a-form-model-item>-->
<!--              </a-col>-->
<!--              <a-col-->
<!--                :md="8"-->
<!--                :sm="8"-->
<!--              >-->
<!--                <a-form-model-item-->
<!--                  label="项目"-->
<!--                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"-->
<!--                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
<!--                  prop="projectId"-->
<!--                >-->
<!--                  <SelectProject-->
<!--                    v-if="!(isDisabled || isDisabledQuestion)"-->
<!--                    v-model="formInfo.projectId"-->
<!--                    key-value="branchComId"-->
<!--                    :form="formInfo"-->
<!--                    :clear-list="true"-->
<!--                  />-->
<!--                  <SelectProject-->
<!--                    v-else-->
<!--                    v-model="formInfo.projectId"-->
<!--                    :disabled="true"-->
<!--                    :form="formInfo"-->
<!--                    :clear-list="true"-->
<!--                  />-->
<!--                </a-form-model-item>-->
<!--              </a-col>-->
            </a-row>

            <a-row :gutter="24">
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="发牌日期"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="dealDate"
                >
                  <a-date-picker
                    v-model="formInfo.dealDate"
                    value-format="YYYY-MM-DD"
                    :disabled="isDisabled || isDisabledQuestion"
                  />
                </a-form-model-item>
              </a-col>
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="等级"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="cardLevelId"
                >
                  <a-select
                    v-model="formInfo.cardLevelId"
                    :disabled="isDisabled || isDisabledQuestion"
                    placeholder="请选择等级"
                  >
                    <a-select-option
                      v-for="item in cardLevelList"
                      :key="item.id"
                      :value="item.id"
                    >
                      {{
                      item.name
                    }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="责任人"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="respEmployeeId"
                >
                  <!-- :project-id="isDisabledQuestion || isDisabled?'':formInfo.projectId" -->
                  <SelectPersonByProject
                    :id="formInfo.branchComId"
                    v-model="formInfo.respEmployeeId"
                    :disabled="isDisabled || isDisabledQuestion"
                    :project-id="isDisabledQuestion || isDisabled?'':formInfo.projectId"
                    :show-search="true"
                    @personChanged="personChanged"
                  />
                  <!-- <OrgStaffAsync
                  :disabled="isDisabled"
                  v-model="formInfo.respEmployeeId"
                  :selectedValue.sync="formInfo.respEmployeeId"
                  :treeCheckable="false"
                  :useSingle="true"
                /> -->
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="状态"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="publicityId"
                >
                  <a-select
                    v-model="formInfo.publicityId"
                    :disabled="isDisabled || isDisabledQuestion"
                    placeholder="请选择状态"
                  >
                    <a-select-option
                      v-for="item in noticeStatusList"
                      :key="item.id"
                      :value="item.id"
                    >
                      {{
                      item.name
                    }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="撤销时间"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="cancelTime"
                >
                  <a-date-picker
                    v-model="formInfo.cancelTime"
                    value-format="YYYY-MM-DD"
                    :disabled="isDisabled || isDisabledQuestion"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="发牌原因"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="cardsDealClassification.cardsDealClassificationId"
                >
                  <a-select
                    v-model="formInfo.cardsDealClassification.cardsDealClassificationId"
                    @change="handleChange"
                    :disabled="isDisabled || isDisabledQuestion"
                    placeholder="请选择发牌原因"
                  >
                    <a-select-option
                      v-for="item in classList"
                      :key="item.id"
                      :value="item.id"
                    >
                      {{item.name}}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row
              :gutter="24"
              class="licensReason"
            >
              <a-col
                :md="24"
                :sm="24"
              >
                <a-form-model-item
                  label="发牌原因"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="reasonMultiple"
                >
                  <div
                    v-if="isDisabled || isDisabledQuestion"
                    class="history-data"
                  >
                    <span
                      v-for="item in formInfo.cardsDealClassification.reason"
                      :key="item.cardsDealReasonId"
                    >
                      {{item.cardsDealReason}}
                    </span>
                  </div>
                  <a-select
                    v-else
                    mode="multiple"
                    v-model="formInfo.reasonMultiple"
                    :disabled="isDisabled || isDisabledQuestion"
                    placeholder="可多选"
                  >
                    <a-select-option
                      v-for="item in reasonMultipleArr"
                      :key="item.id"
                      :value="item.id"
                    >
                      {{item.name}}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="24">
                <a-form-model-item
                  label="说明"
                  :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="description"
                >
                  <BaseTextarea
                    v-model="formInfo.description"
                    :disabled="isDisabled || isDisabledQuestion"
                    style="resize: none"
                    placeholder="请输入"
                    :rows="3"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col
                :md="24"
                :sm="24"
              >
                <a-form-model-item
                  label="相关照片"
                  :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="fileIdList"
                >
                  <upload-list
                    :business-code="'SHE06'"
                    :edit-model="filterEditModel(pageType,true)"
                    :upload-arrys.sync="formInfo.fileInfoVOList"
                    upload-type="image"
                    :count="9"
                    multiple
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-card>
          <!-- v-if="pageType === 'question'" -->
          <a-card
            :bordered="false"
            v-if="(pageType === 'question' || formInfo.talkRecord.confessDate) && editModel*1!==1"
          >
            <title-name title="约谈记录"></title-name>
            <a-row :gutter="24">
              <a-col
                :md="8"
                :sm="8"
              >
                <a-form-model-item
                  label="约谈时间"
                  :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="talkRecord.confessDate"
                >
                  <a-date-picker
                    v-model="formInfo.talkRecord.confessDate"
                    value-format="YYYY-MM-DD"
                    :disabled="isDisabled"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="24">
                <a-form-model-item
                  label="会议记录"
                  :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                  prop="talkRecord.confessContent"
                >
                  <BaseTextarea
                    v-model="formInfo.talkRecord.confessContent"
                    :disabled="isDisabled"
                    style="resize: none"
                    placeholder="请输入"
                    :rows="3"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col
                :md="24"
                :sm="24"
              >
                <a-form-model-item
                  label="相关照片"
                  :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                  :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                >
                  <upload-list
                    :business-code="'SHE06'"
                    :edit-model="filterEditModel(pageType,false)"
                    :upload-arrys.sync="formInfo.talkFileInfoVOList"
                    upload-type="image"
                    multiple
                    :count="9"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-form-item
              label="参会者选择："
              prop="meetingEmployeeList"
            >
              <div
                class="mb12"
                v-if="editModel*1!==0"
              >
                <a-button
                  icon="plus"
                  class="btn_right"
                  type="primary"
                  @click="visible = true"
                >
                  添加人员
                </a-button>
                <a-button
                  :disabled="rowSelection.selectedRowKeys.length < 1"
                  icon="delete"
                  type="danger"
                  @click="handleRemoveMore"
                >
                  移除
                </a-button>
              </div>
              <!-- 统计选中项 -->
              <a-alert
                :show-icon="true"
                v-if="editModel*1!==0"
              >
                <template slot="message">
                  <span style="margin-right: 12px">
                    已选择:
                    <a>
                      <b>{{ rowSelection.selectedRowKeys.length }}</b>
                    </a>
                    项
                  </span>
                </template>
              </a-alert>
              <!-- 表格 -->
              <s-table
                ref="tableEmployee"
                table-layout="fixed"
                size="default"
                row-key="userId"
                :columns="columnsEmployee"
                :data="loadDataEmployee"
                :alert="true"
                :row-selection="rowSelection"
                show-size-changer
                show-quick-jumper
                show-pagination="auto"
              >
                <!-- 表格行操作栏 -->
                <span
                  slot="actions"
                  slot-scope="text, record, index"
                  v-if="editModel*1!==0"
                >
                  <template>
                    <a @click="handleRemove(index)">移除</a>
                  </template>
                </span>
              </s-table>
            </a-form-item>
          </a-card>
          <div
            v-if="pageType !== 'look'"
            class="tool-btns page-btn-right-top"
          >
            <!-- <a-button type="danger" v-if="pageType !== 'add'" :loading="loading.DELETE" @click="handleSave('DELETE')">删除草稿</a-button>
        <a-button type="primary" :loading="loading.DRAFT" @click="handleSave('DRAFT')">保存草稿</a-button> -->
            <a-button
              type="primary"
              :loading="loading.SUBMITTED"
              @click="handleSave('SUBMITTED')"
            >
              提交
            </a-button>
            <a-button
              type="primary"
              @click="handleClose"
            >
              关闭
            </a-button>
          </div>
          <div
            v-else
            class="tool-btns page-btn-right-top"
          >
            <a-button
              type="primary"
              @click="handleClose"
            >
              关闭
            </a-button>

          </div>

        </a-spin>
      </a-form-model>
    </div>
    <SelectPerson
      primary-key="userId"
      @getSelectPerson="$refs.tableEmployee.refresh()"
      :list.sync="formInfo.meetingEmployeeList"
      title="选择人员"
      mode="multiple"
      :visible.sync="visible"
    >
    </SelectPerson>

  </base-breadcrumb>
</template>
<script>
import OrgStaffAsync from '@/components/TreeSelectOrganization/orgStaffAsync.vue'
import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
import SelectProject from '@/components/Select/SelectProject' // 项目
import UploadList from '@/components/UploadList'
import SelectPersonByProject from '@/components/Select/SelectPersonByProject' // 分公司
import SelectPerson from '@/components/Select/SelectPerson'
import api from '@/api/safetySupervision/base/licensingReason'
import { STable } from '@/components'
import { getCardNoticeDetail, addCardNotice, deleteCardNotice, updateSystemManage } from '@/api/safetySupervision/cardNotice.js'
import { getSelectListByType } from '@/api/safetySupervision/common.js'
import moment from 'moment'

export default {
  name: 'a' + Date.now(),
  components: {
    UploadList,
    SelectSubCompany,
    SelectProject,
    SelectPersonByProject,
    SelectPerson,
    STable
  },
  data() {
    return {
      dealObjList: [], // 发牌对象
      cardLevelList: [], // 等级
      noticeStatusList: [], // 公示状态
      loading: {
        DELETE: false,
        DRAFT: false,
        SUBMITTED: false
      },
      loadingDetail: false,
      formInfo: {
        branchComId: '',
        projectId: '',
        dealDate: null,
        cardLevelId: '',
        respEmployeeId: '',
        respNamePost: '',
        publicityId: '',
        description: '',
        fileInfoVOList: [],
        meetingEmployeeList: [],
        talkFileInfoVOList: [],
        cardsDealClassification: {
          cardsDealClassificationId: null
        },
        talkRecord: {
          confessDate: null
        },
        reasonMultiple: []
      },
      editModel: null,
      classList: [], //分类
      reasonMultipleArr: [], //多选发牌
      dataDatail: null,
      rules: {
        branchComId: [{ required: true, message: '请选择', trigger: 'change' }],
        projectId: [{ required: true, message: '请选择', trigger: 'change' }],
        dealDate: [{ required: true, message: '请选择', trigger: 'change' }],
        cardLevelId: [{ required: true, message: '请选择', trigger: 'change' }],
        respEmployeeId: [{ required: true, message: '请选择', trigger: 'change' }],
        publicityId: [{ required: true, message: '请选择', trigger: 'change' }],
        description: [{ required: true, message: '请输入', trigger: 'change' }],
        dealObjId: [{ required: true, message: '请选择', trigger: 'change' }],
        cancelTime: [{ required: true, message: '请选择撤销时间', trigger: 'change' }],
        'cardsDealClassification.cardsDealClassificationId': [{ required: true, message: '请选择发牌原因', trigger: 'change' }],
        reasonMultiple: [{ required: true, message: '请选择发牌原因', trigger: 'change' }],
        'talkRecord.confessDate': [{ required: true, message: '请选择约谈时间', trigger: 'change' }],
        'talkRecord.confessContent': [{ required: true, message: '请输入会议记录', trigger: 'change' }]
      },
      visible: false,
      selectRows: [],
      columnsEmployee: [
        { title: '员工名称', dataIndex: 'name' },
        { title: '电话号码', dataIndex: 'phone' },
        {
          title: '操作',
          dataIndex: 'actions',
          width: '100px',
          scopedSlots: { customRender: 'actions' }
        }
      ],
      loadDataEmployee: (parameter) => {
        return new Promise((resolve, reject) => {
          let obj = {}
          obj.code = 200
          obj.currentPage = parameter.pageNo
          obj.pageSize = parameter.pageSize

          obj.totalPage = Math.ceil(this.formInfo.meetingEmployeeList.length / parameter.pageSize)
          obj.totalSize = this.formInfo.meetingEmployeeList.length
          obj.data = this.formInfo.meetingEmployeeList || []
          // console.log(obj)
          resolve(obj)
        })
      },

      // 表格复选框配置
      rowSelection: {
        selectedRowKeys: [],
        onChange(selectedRowKeys) {
          this.selectedRowKeys = selectedRowKeys
        }
      }
    }
  },
  computed: {
    pageType() {
      return this.$route.query.pageType || 'look'
    },
    isDisabled() {
      return this.pageType === 'look'
    },
    isDisabledQuestion() {
      return this.pageType === 'question'
    }
  },
  created() {
    let pageType = this.pageType
    this.editModel = pageType === 'look' ? '0' : pageType === 'edit' ? '1' : pageType === 'add' ? '2' : pageType === 'question' ? '3' : 0
    this.$route.meta.title = [' 红黄牌公示  查看', ' 红黄牌公示  编辑', ' 红黄牌公示  新增', ' 红黄牌公示 约谈记录'][this.editModel]
    this.getAllSelectList()
    this.getClassList()
    this.getDetail()
  },
  watch: {
    'formInfo.cardsDealClassification.cardsDealClassificationId': {
      handler(newVal, oldVal) {
        this.selectReason(newVal)
      },
      deep: true
    }
  },
  methods: {
    selectOrg(val) {
      this.formInfo.branchComId = val[val.length - 2].orgId
    },
    personChanged(val) {
      if (val && val.employeeName) {
        this.formInfo.respNamePost = val.employeeName
      }
    },
    handleChange() {
      this.formInfo.reasonMultiple = []
    },
    //获取发牌原因
    async getClassList() {
      this.classList = []
      let data = await api.getClassList({})
      if (data?.msg === '成功') {
        let className = data.data
        if (className.length) {
          className.map((item) => {
            this.classList.push({
              id: item.id,
              name: item.typeName
            })
          })
        }
      }
    },
    //选择原因
    selectReason(e) {
      this.reasonMultipleArr = []
      if (!e) return
      api
        .getPrimaryKeySelectiveList({ classificationId: e })
        .then((res) => {
          let data = res.data.length && res.data.filter((item) => item.status * 1 === 0)
          if (data.length) {
            data.map((item) => {
              this.reasonMultipleArr.push({
                id: item.id,
                name: item.dealReason
              })
            })
          }
        })
        .catch((err) => {})
    },
    selectClick(e) {
      let { rows, keys } = e
      this.selectRows = rows
    },
    handleRemove(index) {
      this.formInfo.meetingEmployeeList.splice(index, 1)
      this.$refs.tableEmployee.refresh(true)
    },
    // 移除表格选中项
    handleRemoveMore() {
      // 若有选中项
      let that = this
      that.$confirm({
        title: '温馨提示',
        content: '确定移除这些数据？',
        okText: '确认',
        okType: 'danger',
        cancelText: '取消',
        onOk() {
          for (let index = 0; index < that.formInfo.meetingEmployeeList.length; index++) {
            let item = that.formInfo.meetingEmployeeList[index]
            if (that.rowSelection.selectedRowKeys.includes(item.userId)) {
              that.formInfo.meetingEmployeeList.splice(index, 1)
              index--
            }
          }
          that.$refs.tableEmployee.clearSelected()
          that.$refs.tableEmployee.refresh(true)
          // console.log(that.rowSelection.selectedRowKeys)
        }
      })
    },
    // 获取下拉列表数据
    getAllSelectList() {
      const loopList = [
        {
          name: 'dealObjList',
          type: 4
        },
        {
          name: 'cardLevelList',
          type: 3
        },
        {
          name: 'noticeStatusList',
          type: 9
        }
      ]
      loopList.forEach((item) => {
        this.getSelectList(item.type, item.name)
      })
    },
    async getSelectList(type, name) {
      const [err, res] = await getSelectListByType({ type })
      if (!err) {
        this[name] = res.data || []
      }
    },
    validateForm() {
      let flag = false
      this.$refs.form.validate((valid) => {
        flag = valid
      })
      return flag
    },
    async getDetail() {
      const { id } = this.$route.query

      if (!id) return
      this.loadingDetail = true
      const params = {
        id
      }
      const [err, res] = await getCardNoticeDetail(params)
      this.loadingDetail = false
      if (!err) {
        let participantListDTO = res.data.participantListDTO
        let reason = res.data?.cardsDealClassification?.reason,
          reasonMultiple = []
        if (participantListDTO && participantListDTO.length > 0) {
          participantListDTO.map((item) => {
            item.name = item.participantName
            item.userId = item.participantId
            item.phone = item.phoneNum
            // item.id ='31e71664840148338fb0254e72591641'
          })
        }
        if (!res.data.cardsDealClassification) {
          res.data.cardsDealClassification = {}
        }
        if (!res.data.talkRecord) {
          res.data.talkRecord = {}
        }
        this.formInfo = {
          ...this.formInfo,
          ...res.data
        }
        setTimeout(() => {
          if (participantListDTO && participantListDTO.length > 0) {
            //数据回显
            participantListDTO.map((item, index) => {
              this.$set(this.formInfo.meetingEmployeeList, index, item)
            })
          }
          if (reason && reason.length) {
            reason.map((item) => {
              reasonMultiple.push(item.cardsDealReasonId)
            })
          }
          this.formInfo.reasonMultiple = reasonMultiple
          this.$refs.tableEmployee && this.$refs.tableEmployee.refresh()
        }, 1000)
        if (this.isDisabledQuestion || this.isDisabled) {
          this.formInfo.respEmployeeId = this.formInfo.respNamePost
          this.formInfo.branchComId = this.formInfo.branchComName
          this.formInfo.projectId = this.formInfo.projectId
          this.dataDatail = res.data
        }
      }
    },
    filterEditModel(type, isTrue) {
      let flag = ''
      if (type === 'add') {
        flag = 2
      } else if (type === 'edit') {
        flag = 1
      } else if (type === 'look' || (type === 'question' && isTrue)) {
        flag = 0
      } else if (type === 'question' && !isTrue) {
        flag = 1
      } else {
        flag = 0
      }
      return flag
    },
    // 处理增、删、改操作
    async handleSave(status) {
      if (status !== 'DELETE' && !this.validateForm()) return
      if (this.loading[status]) return
      this.loading[status] = true
      this.formInfo.cardsDealClassification.reason = []
      this.formInfo.participantListDTO = []
      let reasonMultiple = this.formInfo.reasonMultiple,
        participantListDTO = this.formInfo.meetingEmployeeList,
        reason = this.formInfo.cardsDealClassification.reason
      reasonMultiple.map((item) => {
        let nameArr = this.reasonMultipleArr.find((fItem) => fItem.id == item),
          name = nameArr?.name
        reason.push({
          cardsDealReason: name,
          cardsDealReasonId: item
        })
      })

      if (this.isDisabledQuestion) {
        this.formInfo.respEmployeeId = this.dataDatail.respEmployeeId
        this.formInfo.branchComId = this.dataDatail.branchComId
        this.formInfo.projectId = this.dataDatail.projectId
        this.formInfo.respNamePost = this.dataDatail.respNamePost
      }
      if (participantListDTO && participantListDTO.length > 0) {
        participantListDTO.map((item) => {
          item.participantId = item.userId
          item.participantName = item.name
          item.phoneNum = item.phone
        })
      }
      this.formInfo.participantListDTO = participantListDTO
      this.formInfo.talkRecord.fileList = []
      delete this.formInfo.meetingEmployeeList
      const params = {
        ...this.formInfo,
        id: this.$route.query.id || void 0,
        auditStatus: status
      }
      const fn = this.editModel * 1 !== 2 ? updateSystemManage : addCardNotice
      const map = {
        DELETE: deleteCardNotice,
        DRAFT: fn,
        SUBMITTED: fn
      }
      const [err, res] = await map[status](params)
      if (!err) {
        this.$message.success('成功')
        this.handleClose()
      }
      this.loading[status] = false
    },
    handleClose() {
      this.$multiTab.close(this.$route.fullpath)
    }
  }
}
</script>

<style lang="less" scoped>
@deep: ~'>>>';
.page-body {
  .ant-radio-group {
    width: 100%;
  }
  form .ant-mentions,
  form textarea.ant-input {
    height: auto !important;
    width: 100%;
  }
}
.row-title {
  font-weight: bold;
}
.tool-btns {
  display: flex;
  justify-content: flex-end;
  @{deep} .ant-btn + .ant-btn {
    margin-left: 12px;
  }
}
.licensReason {
  @{deep} .ant-form-item-label label {
    color: #fff;
  }
  .history-data {
    border: 1px solid #d9d9d9;
    line-height: 32px;
    height: 32px;
    background-color: #f5f5f5;
    cursor: not-allowed;
    border-radius: 3px;
    padding-left: 10px;
    span {
      display: inline-block;
      padding: 0 6px;
      height: 20px;
      background-color: #fafafa;
      border: 1px solid #fff9e8;
      border-radius: 2px;
      margin-right: 5px;
      line-height: 20px;
    }
  }
}
</style>
